
//
//  WZButton+Extension.swift
//  weibo
//
//  Created by mac on 16/3/8.
//  Copyright © 2016年 mac. All rights reserved.
//

import UIKit

extension UIButton{
    
    
    
    convenience init(title: String?,image: String?,selectedImage: String?,tag: Int,target:AnyObject?,action: Selector){
        self.init()
        self.setTitle(title, forState: UIControlState.Normal)
        
        if let Oimage = image{
            
            self.setBackgroundImage(UIImage(named: Oimage), forState: UIControlState.Normal)
        }
        if let OselectedImage = selectedImage{
            self.setBackgroundImage(UIImage(named: OselectedImage), forState: UIControlState.Selected)
        }
        
    self.tag = tag
        
        self.addTarget(target, action: action, forControlEvents: UIControlEvents.TouchUpInside)
    }
    
 
    
}
